package com.chengzhi.disruptor.multi;

import com.lmax.disruptor.WorkHandler;

import java.util.concurrent.atomic.AtomicInteger;

public class OrderConsumer implements WorkHandler<Order> {
    private String consumerId;

    public OrderConsumer(String consumerId) {
        this.consumerId = consumerId;
    }

    private static AtomicInteger atomicInteger= new AtomicInteger(0);

    public AtomicInteger getAtomicInteger() {
        return atomicInteger;
    }

    @Override
    public void onEvent(Order event) throws Exception {
        System.out.println("消费者--------" + this.consumerId + "   orderId:"  + event.getId());
        atomicInteger.incrementAndGet();
    }
}
